package day10.Enum;

/**
 * @Auther:小陈的Java
 * 学生等级
 */
public class Student {
    private String name;
    private String grade;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getGrade() {
        return grade;
    }

    public void setGrade(String grade) {
        if(grade.equals("A") || grade.equals("B") || grade.equals("C")){
            this.grade = grade;
        }else {
            throw new RuntimeException("不是合法的等级");
        }
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", grade='" + grade + '\'' +
                '}';
    }
    public static void main(String[] args) {
        Student student = new Student();
        student.setGrade("A");
        student.setName("张三");
        System.out.println(student);
    }
}
